package com.shengzidong.keepacounts.avtivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.shengzidong.keepacounts.R;

public class MessageActivity extends AppCompatActivity implements OnClickListener {

    Button btn_ok;
    EditText et;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message);

        btn_ok = (Button) findViewById(R.id.btn_Ok);
        et = (EditText) findViewById(R.id.et);

        btn_ok.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        String message = et.getText().toString();
        Intent data = new Intent();
        data.putExtra("message", message);
        setResult(RESULT_OK, data);
        this.finish();
    }
}
